<?php

use yii\helpers\Html;
use yii\widgets\ActiveForm;
use kartik\file\FileInput;
use yii\helpers\ArrayHelper;
use common\models\shop\ShopSlide;
/* @var $this yii\web\View */
/* @var $model common\models\shop\ShopSlide */
/* @var $form yii\widgets\ActiveForm */
?>

<div class="row">
    <div class="col-lg-12">
        <section class="panel">
        <div class="panel-body">
            <div class="adv-table editable-table ">
                <div class="shop-slide-form">
                    <?php $form = ActiveForm::begin([
                        'options' => ['class' => 'form-horizontal','enctype' => 'multipart/form-data'],
                        'fieldConfig' => [
                            'template' => "<div class='col-xs-3 col-sm-2 text-right'>{label}</div><div class='col-xs-9 col-sm-7'>{input}</div><div class='col-xs-12 col-xs-offset-3 col-sm-3 col-sm-offset-0'>{error}</div>",
                        ]
                    ]); ?>

                        <?= $form->field($model, 'title')->textInput(['maxlength' => true]) ?>

                        <?= $form->field($model, 'picture')->widget(FileInput::classname(), [
                            'options' => ['multiple' => false],
                            'pluginOptions' => [
                                // 需要预览的文件格式
                                'previewFileType' => 'image',
                                // 预览的文件
                                'initialPreview' => \common\components\Upload::checkGetUrl($model->picture,false,'picture'),
                                // 需要展示的图片设置，比如图片的宽度等
                                'initialPreviewConfig' => ['width' => '120px'],
                                // 是否展示预览图
                                'initialPreviewAsData' => true,
                                'showUpload' => false,
                            ],
                        ]); ?>

                        <?= $form->field($model, 'status')->dropDownList(ShopSlide::$statues); ?>

                        <?= $form->field($model, 'type')->dropDownList(ShopSlide::$types); ?>

                        <?= $form->field($model, 'link')->textInput(['maxlength' => true]) ?>

                    <div class="form-group">
                        <?= Html::submitButton($model->isNewRecord ? '确认提交' : '确认更新', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
                    </div>
                    <?php ActiveForm::end(); ?>
                </div>
            </div>
        </div>
    </section>
</div>
</div>